package JuniTest;

import bean.Athlete;
import dao.impl.AthleteDaoImpl;
import junit.framework.TestCase;
import org.junit.Test;

import java.util.ArrayList;

/**
 * @Author leiHua
 * @Date 2022/6/13 22:46
 */
public class AthleteDaoTest extends TestCase {
    AthleteDaoImpl athleteDao = new AthleteDaoImpl();
    Athlete athlete=new Athlete("10", "juni测试", "男", 20, "计算机", null);
    @Test
    public void testAthleteDaoSelect(){
        Athlete select = athleteDao.select("1");
        System.out.println(select.toString());
        assertNotNull(select.getAge());
    }
    @Test
    public void testAthleteDaoSelectAll(){
        ArrayList<Athlete> athleteArrayList = athleteDao.selectAll();
        for (Athlete athlete : athleteArrayList) {
            System.out.println(athlete.toString());
        }

    }

    @Test
    public void testAthleteDaoadd(){
        boolean add = athleteDao.add(athlete);
        assertTrue(add);
    }

    @Test
    public void testAthleteDaoSelectDependName(){
        String name = athlete.getName();
        Athlete athleteDependName = athleteDao.selectDependName(name, null);
        System.out.println(athleteDependName.toString());
    }

    @Test
    public void testAthleteDaoDelete(){
        String a_id = athlete.getA_id();
        boolean delete = athleteDao.delete(a_id);
        assertTrue(delete);
    }

}
